package com.ck.ips.dao.sys;

import com.ck.common.model.Department;
import com.ck.ips.model.dto.sys.DepartmentTreeDTO;
import com.ck.ips.model.vo.sys.DepartmentListVO;
import com.ck.ips.model.vo.sys.DepartmentSelectListVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface DepartmentMapper {
	/**
	 * 保存部门
	 *
	 * @param department
	 */
	void insertDepartment(Department department);

	/**
	 * 修改部门
	 *
	 * @param department Department
	 */
	void updateDepartment(Department department);

	/**
	 * 通过部门ID获取部门
	 *
	 * @param departmentId 部门ID
	 * @return Department
	 */
	Department getDepartmentById(Long departmentId);

	/**
	 * 部门列表
	 *
	 * @param status         状态
	 * @param departmentName 部门名称
	 * @return Page<DepartmentListDTO>
	 */
	Page<DepartmentListVO> listDepartment(@Param("status") Integer status, @Param("departmentName") String departmentName);

	/**
	 * 获取所有启用的部门
	 *
	 * @return List<DepartmentSelectListVO>
	 */
	List<DepartmentSelectListVO> listDepartmentSelect(@Param("status") Integer status);

	/**
	 * 获取部门树列表
	 *
	 * @param status 状态
	 * @return List<DepartmentTreeDTO>
	 */
	List<DepartmentTreeDTO> listDepartmentTree(@Param("status") Integer status);

	/**
	 * 批量设置部门状态
	 *
	 * @param childIdList
	 * @param status
	 */
	void batchEnableDisable(@Param("childIdList") List<Long> childIdList, @Param("status") Integer status);

	/**
	 * 获取某个部门的所有子部门id,包含该部门本身
	 *
	 * @param departmentId
	 * @return
	 */
    String getChildIds(@Param("departmentId") Long departmentId);

	/**
	 * 获取某个部门id下的用户id集合
	 *
	 * @param departmentId
	 * @return
	 */
	String getUserIdsByDepartmentId(@Param("departmentId") Long departmentId);

	/**
	 * 删除部门
	 *
	 * @param departmentId
	 */
	void deleteDepartment(@Param("departmentId") Long departmentId);

	/**
	 * 根据部门名称获取部门信息
	 *
	 * @param departmentName
	 * @return
	 */
	Department getByDepartmentName(@Param("departmentName") String departmentName);
}